package cn.credit.loan.service.purpose;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.credit.loan.dao.purpose.PurposeMapper;
import cn.credit.loan.entity.Purpose;

@Service
public class PurposeServiceImpl implements PurposeService {
	@Autowired
	private PurposeMapper purposeMapper;

	/**
	 * 查看贷款用途类型列表
	 */
	@Override
	public List<Purpose> getPurpose() throws Exception {
		List<Purpose> purposelist = purposeMapper.getPurpose();
		if (purposelist != null) {
			return purposelist;
		}
		return null;
	}

	/**
	 * 添加贷款用途类型
	 */
	@Override
	public Boolean addPurpose(Purpose purpose) throws Exception {
		if (purpose != null) {
			if (purposeMapper.addPurpose(purpose) > 0) {
				return true;
			}
		}
		return false;
	}

}
